from nmj.sqlite.base_item import BaseNmjDB
from nmj.sqlite.nmj_db import NMJDB
from nmj.sqlite.nmj_db_v2 import NMJDBv2
import logging

_LOGGER = logging.getLogger(__name__)

def get_nmj_db(local_directory):
	db = BaseNmjDB(local_directory)
	if db.get_DB_version() == [("2.0.0",)]:
		return NMJDBv2(local_directory)
	return NMJDB(local_directory)
